﻿using iTextSharp.text;
using iTextSharp.text.pdf;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ItextSharpDemo
{
    public class FooterAndHeaderPdf : IPdfCreator
    {
        public void Create(string fileName)
        {
            var doc = new Document();
            PdfWriter.GetInstance(doc, new FileStream(fileName, FileMode.Create));

            HeaderFooter header = new HeaderFooter(new Phrase("this is the page"), false);
            header.Alignment = HeaderFooter.ALIGN_CENTER;
            doc.Header = header;

            doc.Footer = new HeaderFooter(new Phrase("C&C Reservoirs"), false);
            doc.Open();
            doc.Add(new Paragraph("What was the day today?"));

            doc.Close();
        }


    }
}
